import 'package:flutter_nb_net/flutter_net.dart';

class ExternalOrderInfoResp extends BaseNetModel {
  int? code;
  String? msg;
  ExternalOrderInfo? data;

  ExternalOrderInfoResp({
    this.code,
    this.msg,
    this.data,
  });

  @override
  fromJson(Map<String, dynamic> json) {
    return ExternalOrderInfoResp(
      code: json['code'],
      msg: json['msg'],
      data: json['data'] == null ? null : ExternalOrderInfo().fromJson(json['data']),
    );
  }
}

class ExternalOrderInfo extends BaseNetModel {
  String? orderNo;
  int? orderType;
  int? orderStatus;
  String? imei;
  int? modelId;
  String? modelCode;
  int? goodsNum;
  double? goodsPrice;
  double? goodsTotalPrice;
  int? payType;
  double? payAmount;
  // DateTime? payTime;
  String? payAccount;
  int? userId;
  String? appId;
  String? appPlatform;
  String? phone;
  String? devicePhone;
  MiniAppInfo? miniAppInfo;
  OrderPackage? orderPackage;

  ExternalOrderInfo({
    this.orderNo,
    this.orderType,
    this.orderStatus,
    this.imei,
    this.modelId,
    this.modelCode,
    this.goodsNum,
    this.goodsPrice,
    this.goodsTotalPrice,
    this.payType,
    this.payAmount,
    // this.payTime,
    this.payAccount,
    this.userId,
    this.appId,
    this.appPlatform,
    this.phone,
    this.devicePhone,
    this.miniAppInfo,
    this.orderPackage,
  });

  @override
  fromJson(Map<String, dynamic> json) {
    return ExternalOrderInfo(
      orderNo: json['orderNo'],
      orderType: json['orderType'],
      orderStatus: json['orderStatus'],
      imei: json['imei'],
      modelId: json['modelId'],
      modelCode: json['modelCode'],
      goodsNum: json['goodsNum'],
      goodsPrice: json['goodsPrice'],
      goodsTotalPrice: json['goodsTotalPrice'],
      payType: json['payType'],
      payAmount: json['payAmount'],
      // payTime: DateTime.parse(json['payTime']),
      payAccount: json['payAccount'],
      userId: json['userId'],
      appId: json['appId'],
      appPlatform: json['appPlatform'],
      phone: json['phone'],
      devicePhone: json['devicePhone'],
      miniAppInfo: json['miniAppInfo'] == null ? null : MiniAppInfo().fromJson(json['miniAppInfo']),
      orderPackage: json['orderPackage'] == null ? null : OrderPackage().fromJson(json['orderPackage']),
    );
  }
}

class MiniAppInfo extends BaseNetModel {
  String? originalId;
  String? jumpPath;

  MiniAppInfo({
    this.originalId,
    this.jumpPath,
  });

  @override
  fromJson(Map<String, dynamic> json) {
    return MiniAppInfo(
      originalId: json['originalId'],
      jumpPath: json['jumpPath'],
    );
  }
}

class OrderPackage extends BaseNetModel {
  String? orderNo;
  String? cardMerchant;
  String? packageCode;
  String? packageName;
  double? price;

  OrderPackage({
    this.orderNo,
    this.cardMerchant,
    this.packageCode,
    this.packageName,
    this.price,
  });

  @override
  fromJson(Map<String, dynamic> json) {
    return OrderPackage(
      orderNo: json['orderNo'],
      cardMerchant: json['cardMerchant'],
      packageCode: json['packageCode'],
      packageName: json['packageName'],
      price: json['price'],
    );
  }
}
